package com.kgar.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Trimb
 */
@Configuration
public class OssConfig {


    // Endpoint外网访问域名，以上海为例。
    @Value("${aliyun.oss.endpoint}")
    private  String endpoint ;
    // accessKeyId 和 accessKeySecret 是先前创建用户生成的
    @Value("${aliyun.oss.accessKeyId}")
    private  String accessKeyId ;
    @Value("${aliyun.oss.accessKeySecret}")
    private  String accessKeySecret ;
    @Bean
    public OSS ossClientBuilder(){
        return new OSSClientBuilder().build(endpoint,accessKeyId,accessKeySecret);
    }
}
